package com.lagou.edu.service.impl;


import com.lagou.edu.dao.ResumeDao;
import com.lagou.edu.pojo.Resume;
import com.lagou.edu.service.ResumeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;


@Service
@Transactional
public class ResumeServiceImpl implements ResumeService {

    @Autowired
    private ResumeDao resumeDao;


    @Override
    public void save(Resume resume) {
        resumeDao.save(resume) ;
    }

    @Override
    public void update(Resume resume) {
        resumeDao.save(resume) ;
    }

    @Override
    public void delete(int id) {
        resumeDao.deleteById(id) ;
    }

    @Override
    public List<Resume> showList() {
        return resumeDao.findAll();
    }

    @Override
    public Resume show(int id) {
        Optional<Resume> optional= resumeDao.findById(id) ;
        Resume resume = optional.get();
        return resume ;
    }
}
